﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="List.aspx.cs" Inherits="MonkeyWarranty.Web.InstantTickets.List" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <title><%=Resources.GlobalStrings.InstantTickets %></title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
	    <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
		    <li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#tabs-1"><%=Resources.GlobalStrings.Received %></a></li>
		    <li class="ui-state-default ui-corner-top"><a href="#tabs-2"><%=Resources.GlobalStrings.Processing %></a></li>
		    <li class="ui-state-default ui-corner-top"><a href="#tabs-3"><%=Resources.GlobalStrings.Completed %></a></li>
	    </ul>
        <div id="tabs-1" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide">
		    <div id="NewInstantTicketsTableContainer"></div>
	    </div>
	    <div id="tabs-2" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide">
		    <div id="ProcessingInstantTicketsTableContainer"></div>
	    </div>
	    <div id="tabs-3" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
		    <div id="CompletedInstantTicketsTableContainer"></div>
	    </div>
    </div>
    
    <p><input type="button" value="<%=Resources.GlobalStrings.AddNew %>" onclick="javascript:window.location='New.aspx';" /></p>
    
    <script type="text/javascript">
        $(document).ready(function () {
            $("#tabs").tabs();
            LoadNewTickets();
            LoadProcessingTickets();
            LoadCompletedTickets();
        });
    </script>
    
    <script type="text/javascript">
        function LoadNewTickets() {
            $('#NewInstantTicketsTableContainer').jtable({
                //title: '<%=Resources.GlobalStrings.InstantTickets %>',
                paging: true,
                pageSize: 15,
                sorting: true,
                defaultSorting: 'CreatedDate DESC',
                actions: {
                    listAction: 'List.aspx/NewTicketListByFilter',
                    //createAction: 'List.aspx/CreateProduct',
                    //updateAction: 'List.aspx/UpdateProduct',
                    deleteAction: 'List.aspx/DeleteTicket'
                },
                fields: {
                    Id: {
                        key: true,
                        create: false,
                        edit: false,
                        list: false
                    },
                    CreatedDate: {
                        title: '<%=Resources.GlobalStrings.ReceivedDate %>',
                        type: 'date',
                        displayFormat: 'dd/mm/yy',
                        width: '7%'
                    },
                    CreatedTimeString: {
                        title: '<%=Resources.GlobalStrings.ReceivedHour %>',
                        sorting: false,
                        width: '5%'
                    },
                    Code: {
                        title: '<%=Resources.GlobalStrings.TicketNumber %>',
                        width: '5%'
                    },
                    EmployeeName: { title: '<%=Resources.GlobalStrings.ReceivedEmployee %>' },
                    CustomerName: { title: '<%=Resources.GlobalStrings.Customers %>' },
                    Phone: { title: '<%=Resources.GlobalStrings.Phone %>', width: '7%' },
                    Address: { title: '<%=Resources.GlobalStrings.Address %>' },
                    TicketContent: { title: '<%=Resources.GlobalStrings.Content %>', sorting: false },
                    //Distance: { title: '<%=Resources.GlobalStrings.Distance %>', sorting: false },
                    //Amount: { title: '<%=Resources.GlobalStrings.Amount %>', sorting: false },
                    //StatusName: { title: '<%=Resources.GlobalStrings.Status %>', sorting: false },
                    Edit: {
                        title: '',
                        sorting: false,
                        width: '1%',
                        display: function (data) {
                            return '<input class="jtable-command-button jtable-edit-command-button" onclick="javascript:window.location=\'Edit.aspx?id=' + data.record.Id + '\';" />';
                        }
                    }
                }
            });

            $('#NewInstantTicketsTableContainer').jtable('load');
        }

        function LoadProcessingTickets() {
            $('#ProcessingInstantTicketsTableContainer').jtable({
                //title: '<%=Resources.GlobalStrings.InstantTickets %>',
                paging: true,
                pageSize: 10,
                sorting: true,
                defaultSorting: 'CreatedDate DESC',
                actions: {
                    listAction: 'List.aspx/ProcessingTicketListByFilter',
                    //createAction: 'List.aspx/CreateProduct',
                    //updateAction: 'List.aspx/UpdateProduct',
                    deleteAction: 'List.aspx/DeleteTicket'
                },
                fields: {
                    Id: {
                        key: true,
                        create: false,
                        edit: false,
                        list: false
                    },
                    CreatedDate: {
                        title: '<%=Resources.GlobalStrings.ReceivedDate %>',
                        type: 'date',
                        displayFormat: 'dd/mm/yy',
                        width: '7%'
                    },
                    CreatedTimeString: {
                        title: '<%=Resources.GlobalStrings.ReceivedHour %>',
                        sorting: false,
                        width: '5%'
                    },
                    Code: {
                        title: '<%=Resources.GlobalStrings.TicketNumber %>',
                        width: '5%'
                    },
                    EmployeeName: { title: '<%=Resources.GlobalStrings.ReceivedEmployee %>' },
                    CustomerName: { title: '<%=Resources.GlobalStrings.Customers %>' },
                    Phone: { title: '<%=Resources.GlobalStrings.Phone %>', width: '7%' },
                    Address: { title: '<%=Resources.GlobalStrings.Address %>' },
                    TicketContent: { title: '<%=Resources.GlobalStrings.Content %>', sorting: false },
                    //Distance: { title: '<%=Resources.GlobalStrings.Distance %>', sorting: false },
                    //Amount: { title: '<%=Resources.GlobalStrings.Amount %>', sorting: false },
                    //StatusName: { title: '<%=Resources.GlobalStrings.Status %>', sorting: false },
                    Edit: {
                        title: '',
                        sorting: false,
                        width: '1%',
                        display: function (data) {
                            return '<input class="jtable-command-button jtable-edit-command-button" onclick="javascript:window.location=\'Edit.aspx?id=' + data.record.Id + '\';" />';
                        }
                    }
                }
            });

            $('#ProcessingInstantTicketsTableContainer').jtable('load');
        }

        function LoadCompletedTickets() {
            $('#CompletedInstantTicketsTableContainer').jtable({
                //title: '<%=Resources.GlobalStrings.InstantTickets %>',
                paging: true,
                pageSize: 10,
                sorting: true,
                defaultSorting: 'CreatedDate DESC',
                actions: {
                    listAction: 'List.aspx/CompletedTicketListByFilter',
                    //createAction: 'List.aspx/CreateProduct',
                    //updateAction: 'List.aspx/UpdateProduct',
                    //deleteAction: 'List.aspx/DeleteProduct'
                    deleteAction: 'List.aspx/DeleteTicket'
                },
                fields: {
                    Id: {
                        key: true,
                        create: false,
                        edit: false,
                        list: false
                    },
                    CreatedDate: {
                        title: '<%=Resources.GlobalStrings.ReceivedDate %>',
                        type: 'date',
                        displayFormat: 'dd/mm/yy',
                        width: '7%'
                    },
                    CreatedTimeString: {
                        title: '<%=Resources.GlobalStrings.ReceivedHour %>',
                        sorting: false,
                        width: '5%'
                    },
                    Code: {
                        title: '<%=Resources.GlobalStrings.TicketNumber %>',
                        width: '5%'
                    },
                    EmployeeName: { title: '<%=Resources.GlobalStrings.ReceivedEmployee %>' },
                    CustomerName: { title: '<%=Resources.GlobalStrings.Customers %>' },
                    Phone: { title: '<%=Resources.GlobalStrings.Phone %>', width: '7%' },
                    Address: { title: '<%=Resources.GlobalStrings.Address %>' },
                    TicketContent: { title: '<%=Resources.GlobalStrings.Content %>', sorting: false },
                    //Distance: { title: '<%=Resources.GlobalStrings.Distance %>', sorting: false },
                    //Amount: { title: '<%=Resources.GlobalStrings.Amount %>', sorting: false },
                    //StatusName: { title: '<%=Resources.GlobalStrings.Status %>', sorting: false },
                    Edit: {
                        title: '',
                        sorting: false,
                        width: '1%',
                        display: function (data) {
                            return '<input class="jtable-command-button jtable-edit-command-button" onclick="javascript:window.location=\'Edit.aspx?id=' + data.record.Id + '\';" />';
                        }
                    }
                }
            });

            $('#CompletedInstantTicketsTableContainer').jtable('load');
        }
    </script>
</asp:Content>
